package entity;

/**
 * Bid entity.
 * 
 * @author sheryl.tay.2012, mohameds.2012
 * 
 */

public class Bid {
	
	public static final String IN = "in";
	public static final String OUT = "out";
	public static final String PENDING = "-";
	
	private Student student;
	private Section section;
	private double bidAmount;

	/**
	 * Stores "in" or "out" if bidding result is available, otherwise "-".
	 */
	private String bidResult;

	/**
	 * Stores 1 or 2 if bidding round number is available, otherwise 0.
	 */
	private int bidRoundNo;

	public Bid(Student student, Section section, double bidAmount) {
		this.student = student;
		this.section = section;
		this.bidAmount = bidAmount;
	}

	public Bid(Student student, Section section, double bidAmount,
			int bidRoundNo) {
		this(student, section, bidAmount);
		this.bidRoundNo = bidRoundNo;
	}

	public Bid(Student student, Section section, double bidAmount,
			String bidResult, int bidRoundNo) {
		this(student, section, bidAmount, bidRoundNo);
		this.bidResult = bidResult;
	}

	public double getBidAmount() {
		return bidAmount;
	}

	public void setBidAmount(double bidAmount) {
		this.bidAmount = bidAmount;
	}
	
	public void setBidResult(String bidResult) {
		this.bidResult = bidResult;
	}

	public Student getStudent() {
		return student;
	}

	public Section getSection() {
		return section;
	}

	public String getBidResult() {
		return bidResult;
	}

	public int getBidRoundNo() {
		return bidRoundNo;
	}

	@Override
	public String toString() {
		return "Bid [student=" + student + ", section=" + section
				+ ", bidAmount=" + bidAmount + ", bidResult=" + bidResult
				+ ", bidRoundNo=" + bidRoundNo + "]";
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Bid) {
			Bid anotherObj = (Bid) obj;
			return student.equals(anotherObj.getStudent())
					&& section.equals(anotherObj.getSection());
		}
		return false;
	}

}
